/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.dew.discoteca.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 *
 * @author elvis
 */
@Entity
@Table(name = "discoteca")
@NamedQueries({@NamedQuery(name = "Discoteca.findAll", query = "SELECT d FROM Discoteca d"), @NamedQuery(name = "Discoteca.findByCodigo", query = "SELECT d FROM Discoteca d WHERE d.codigo = :codigo"), @NamedQuery(name = "Discoteca.findByNombre", query = "SELECT d FROM Discoteca d WHERE d.nombre = :nombre"), @NamedQuery(name = "Discoteca.findByDireccion", query = "SELECT d FROM Discoteca d WHERE d.direccion = :direccion"), @NamedQuery(name = "Discoteca.findByCapacidad", query = "SELECT d FROM Discoteca d WHERE d.capacidad = :capacidad")})
public class Discoteca implements Serializable {
   private static final long serialVersionUID = 1L;
   @Id
   @GeneratedValue(strategy = GenerationType.AUTO)
   @Basic(optional = false)
   @Column(name = "codigo")
   private Integer codigo;
   @Column(name = "nombre")
   private String nombre;
   @Column(name = "direccion")
   private String direccion;
   @Column(name = "capacidad")
   private Integer capacidad;
   @OneToMany(cascade = CascadeType.ALL, mappedBy = "codigoDiscoteca")
   private List<Lista> listaList;

   public Discoteca() {
   }

   public Discoteca(Integer codigo) {
      this.codigo = codigo;
   }

   public Integer getCodigo() {
      return codigo;
   }

   public void setCodigo(Integer codigo) {
      this.codigo = codigo;
   }

   public String getNombre() {
      return nombre;
   }

   public void setNombre(String nombre) {
      this.nombre = nombre;
   }

   public String getDireccion() {
      return direccion;
   }

   public void setDireccion(String direccion) {
      this.direccion = direccion;
   }

   public Integer getCapacidad() {
      return capacidad;
   }

   public void setCapacidad(Integer capacidad) {
      this.capacidad = capacidad;
   }

   public List<Lista> getListaList() {
      return listaList;
   }

   public void setListaList(List<Lista> listaList) {
      this.listaList = listaList;
   }

   @Override
   public int hashCode() {
      int hash = 0;
      hash += (codigo != null ? codigo.hashCode() : 0);
      return hash;
   }

   @Override
   public boolean equals(Object object) {
      // TODO: Warning - this method won't work in the case the id fields are not set
      if (!(object instanceof Discoteca)) {
         return false;
      }
      Discoteca other = (Discoteca) object;
      if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
         return false;
      }
      return true;
   }

}
